SciPy (pronounced “Sigh Pie”) is open-source software for mathematics, science, and engineering.



stats

from scipy import stats

f_onway

E.g. ANOVA

f_val, p_val = stats.f_oneway(grouped_df.get_group('level1')['col'], 
                              grouped_df.get_group('level2')['col'], 
                              grouped_df.get_group('level3')['col'])  

pearsonr

pearson_coef, p_value = stats.pearsonr(df['col1'], df['col2'])

sparse

csc_matrix

E.g. make a 3x3 identity matrix

import numpy as np
from scipy.sparse import csc_matrix
row = np.array([0, 1, 2])
col = np.array([0, 1, 2])
data = np.ones(3)
csc_matrix((data, (row, col)), shape=(3, 3)).toarray()
#  array([[1., 0., 0.],
#         [0., 1., 0.],
#         [0., 0., 1.]])